﻿using System;
using System.Xml.Linq;

namespace HomeRun.AspectCore.Commands
{
    public class CommandCondition
    {
        public CommandCondition(XElement xElement)
        {
            this.AttributeName = xElement.Attribute("name").Value;
            this.AttributeValue = xElement.Attribute("value").Value;
            this.AttributeValueType = xElement.Attribute("valuetype").Value;
            this.Operator = (Operators)(Enum.Parse(typeof(Operators), xElement.Attribute("op").Value, true));
        }

        public string AttributeName
        {
            get; 
            private set;
        }

        public string AttributeValue
        {
            get; 
            private set;
        }

        public string AttributeValueType
        {
            get;
            private set;
        }

        public Operators Operator
        {
            get;
            private set;
        }
    }
}
